package cn.com.homeyoda.aimate.aihealth.bean;

import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;

import com.wzq.mvvmsmart.utils.TimeUtils;
import com.wzq.mvvmsmart.utils.constant.TimeConstants;

import java.util.ArrayList;

import cn.com.homeyoda.aimate.aihealth.utils.StringUtils;

public class FamilyMembersBean {

    private String msg;
    private int code;
    private DataBean data;

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public DataBean getData() {
        return data;
    }

    public void setData(DataBean data) {
        this.data = data;
    }

    public static class DataBean {
        private int memberNum;
        private ArrayList<FamilyMembers> familyMembers;
        private String familyName;

        public int getMemberNum() {
            return memberNum;
        }

        public void setMemberNum(int memberNum) {
            this.memberNum = memberNum;
        }

        public ArrayList<FamilyMembers> getFamilyMembers() {
            return familyMembers;
        }

        public void setFamilyMembers(ArrayList<FamilyMembers> familyMembers) {
            this.familyMembers = familyMembers;
        }

        public String getFamilyName() {
            return familyName;
        }

        public void setFamilyName(String familyName) {
            this.familyName = familyName;
        }

        public static class FamilyMembers implements Parcelable {
            private String createBy;
            private String createTime;
            private String updateBy;
            private String updateTime;
            private String remark;
            private long id;
            private String faceId;
            private String userId;
            private String name;
            private int sex;
            private String avatar;
            private String birthday;
            private String height;
            private String weight;
            private String chronics;
            private String replenishChronic;
            private int status;
            private int del;
            private String addTime;
            private String chronicList;

            @Override
            public int describeContents() {
                return 0;
            }

            @Override
            public void writeToParcel(Parcel dest, int flags) {
                dest.writeString(this.createBy);
                dest.writeString(this.createTime);
                dest.writeString(this.updateBy);
                dest.writeString(this.updateTime);
                dest.writeString(this.remark);
                dest.writeLong(this.id);
                dest.writeString(this.faceId);
                dest.writeString(this.userId);
                dest.writeString(this.name);
                dest.writeInt(this.sex);
                dest.writeString(this.avatar);
                dest.writeString(this.birthday);
                dest.writeString(this.height);
                dest.writeString(this.weight);
                dest.writeString(this.chronics);
                dest.writeString(this.replenishChronic);
                dest.writeInt(this.status);
                dest.writeInt(this.del);
                dest.writeString(this.addTime);
                dest.writeString(this.chronicList);
            }

            public FamilyMembers() {
            }

            protected FamilyMembers(Parcel in) {
                this.createBy = in.readString();
                this.createTime = in.readString();
                this.updateBy = in.readString();
                this.updateTime = in.readString();
                this.remark = in.readString();
                this.id = in.readLong();
                this.faceId = in.readString();
                this.userId = in.readString();
                this.name = in.readString();
                this.sex = in.readInt();
                this.avatar = in.readString();
                this.birthday = in.readString();
                this.height = in.readString();
                this.weight = in.readString();
                this.chronics = in.readString();
                this.replenishChronic = in.readString();
                this.status = in.readInt();
                this.del = in.readInt();
                this.addTime = in.readString();
                this.chronicList = in.readString();
            }

            public static final Parcelable.Creator<FamilyMembers> CREATOR = new Parcelable.Creator<FamilyMembers>() {
                @Override
                public FamilyMembers createFromParcel(Parcel source) {
                    return new FamilyMembers(source);
                }

                @Override
                public FamilyMembers[] newArray(int size) {
                    return new FamilyMembers[size];
                }
            };

            public String getCreateBy() {
                return createBy;
            }

            public void setCreateBy(String createBy) {
                this.createBy = createBy;
            }

            public String getCreateTime() {
                return createTime;
            }

            public void setCreateTime(String createTime) {
                this.createTime = createTime;
            }

            public String getUpdateBy() {
                return updateBy;
            }

            public void setUpdateBy(String updateBy) {
                this.updateBy = updateBy;
            }

            public String getUpdateTime() {
                return updateTime;
            }

            public void setUpdateTime(String updateTime) {
                this.updateTime = updateTime;
            }

            public String getRemark() {
                return remark;
            }

            public void setRemark(String remark) {
                this.remark = remark;
            }

            public long getId() {
                return id;
            }

            public void setId(long id) {
                this.id = id;
            }

            public String getFaceId() {
                return faceId;
            }

            public void setFaceId(String faceId) {
                this.faceId = faceId;
            }

            public String getUserId() {
                return userId;
            }

            public void setUserId(String userId) {
                this.userId = userId;
            }

            public String getName() {
                return StringUtils.removeAllBank(name);
            }

            public void setName(String name) {
                this.name = name;
            }

            public int getSex() {
                return sex;
            }

            public void setSex(int sex) {
                this.sex = sex;
            }

            public String getAvatar() {
                return avatar;
            }

            public void setAvatar(String avatar) {
                this.avatar = avatar;
            }

            public String getBirthday() {
                return birthday;
            }

            public void setBirthday(String birthday) {
                this.birthday = birthday;
            }

            public String getHeight() {
                return height;
            }

            public void setHeight(String height) {
                this.height = height;
            }

            public String getWeight() {
                return weight;
            }

            public void setWeight(String weight) {
                this.weight = weight;
            }

            public String getChronics() {
                return TextUtils.isEmpty(chronics) ? "无" : chronics;
            }

            public void setChronics(String chronics) {
                this.chronics = chronics;
            }

            public String getReplenishChronic() {
                return replenishChronic;
            }

            public void setReplenishChronic(String replenishChronic) {
                this.replenishChronic = replenishChronic;
            }

            public int getStatus() {
                return status;
            }

            public void setStatus(int status) {
                this.status = status;
            }

            public int getDel() {
                return del;
            }

            public void setDel(int del) {
                this.del = del;
            }

            public String getAddTime() {
                return addTime;
            }

            public void setAddTime(String addTime) {
                this.addTime = addTime;
            }

            public String getChronicList() {
                return chronicList;
            }

            public void setChronicList(String chronicList) {
                this.chronicList = chronicList;
            }

            public String getAge() {
                long age = TimeUtils.getTimeSpanByNow(birthday + " 00:00:00", TimeConstants.DAY) / 365;
                return Math.abs(age) + "岁";
            }

            public String getStringSex(){
                return getSex() == 1 ? "男" : "女";
            }

            public String getStringWeight() {
                return weight+"KG";
            }

            public String getStringHeight() {
                return height+"CM";
            }

        }
    }
}
